#!/bin/sh

set -e
set -x

[ ! -d /execution/geth/chaindata ] && geth init --datadir=/execution /execution/genesis.json
[ $NETWORKID ] && NETWORK="--networkid=$NETWORKID"

geth \
$NETWORKID \
--http \
--http.addr=0.0.0.0 \
--http.api=admin,debug,engine,eth,miner,net,rpc,txpool,web3 \
--http.corsdomain=* \
--http.port=8545 \
--http.vhosts=* \
--ws \
--ws.api=admin,debug,engine,eth,miner,net,rpc,txpool,web3 \
--ws.addr=0.0.0.0 \
--ws.port=8546 \
--ws.origins=* \
--authrpc.vhosts=* \
--authrpc.addr=0.0.0.0 \
--authrpc.port=8551 \
--authrpc.jwtsecret=/execution/jwtsecret \
--datadir=/execution \
--allow-insecure-unlock \
--unlock=0x123463a4b065722e99115d6c222f267d9cabb524 \
--password=/execution/geth_password.txt \
--nodiscover \
--syncmode=full \
--metrics \
--metrics.addr=geth \
--metrics.port=6060 \
--metrics.expensive